package com.guangfeng.yql.comm.netty.util;

import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

public class ChatRoomTextMessageSendUtil {

    public static void sendMessageCollection(String message, ChannelGroup channels) {
        channels.writeAndFlush(msgPot(message));
    }

    public static void sendMessage(String message, Channel channel) {
        channel.writeAndFlush(msgPot(message));
    }

    public static void sendListMessageCollection(String[] messageArr, ChannelGroup channels) {
        for (String message : messageArr) {
            sendMessageCollection(message, channels);
        }
    }

    public static TextWebSocketFrame msgPot(String msg) {
        return new TextWebSocketFrame(msg);
    }
}
